package ${bussPackage}.controller.${entityPackage};


import org.apache.commons.lang.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.ui.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import ${bussPackage}.domain.${entityPackage}.${className};
import ${bussPackage}.service.${entityPackage}.${className}Service;
 import com.aspire.goodscenter.framework.CrudInterface.BaseController;
/**
 * 
 * <br>
 * <b>功能：</b>${className}Controller<br>
 */ 
@Controller
@RequestMapping("/${lowerName}") 
public class ${className}Controller extends BaseController{
	
	private final static Logger logger = LogManager.getLogger(${className}Controller.class);

	@Autowired
	private ${className}Service<${className}> ${lowerName}Service;


	@RequestMapping(value = "/getById")
	public String getById(Model model) throws Exception {

		${className} ${lowerName} = ${lowerName}Service.getById(request);
		if (${lowerName} == null) {
			model.addAttribute("msg", "没有找到对应记录！");
		}
		model.addAttribute(${lowerName});
		return "${lowerName}/getById";
	}

	@RequestMapping(value = "/delete")
	public String delete(Model model) throws Exception {
		${lowerName}Service.remove(request);
		model.addAttribute("msg", "删除成功！");
		return "${lowerName}/delete";
	}

	/**
	 * 更新
	 * 
	 */
	@RequestMapping(value = "modify")
	public String modify(Model model) throws Exception {

		${lowerName}Service.modify(request);
		model.addAttribute("msg", "删除成功！");
		return "${lowerName}/modify";
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "create")
	public String create(Model model) throws Exception {

		${lowerName}Service.create(request);
		model.addAttribute("msg", "删除成功！");
		return "${lowerName}/create";
	}

}
